home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl150e.zip / MATH.H < prev    next >
C/C++ Source or Header  |  1996-06-24  |  4KB  |  143 lines

  1. /*  math.h
  2.  
  3.     Definitions for the math floating point package.
  4.  
  5. */
  6.  
  7. #ifndef  __MATH_H
  8. #define  __MATH_H
  9.  
  10.  
  11. struct complex      /* as used by "_cabs" function */
  12. {
  13.     double  x, y;
  14. };
  15.  
  16. struct _complexl    /* as used by "_cabsl" function */
  17. {
  18.     double  x, y;
  19. };
  20.  
  21. #define cabs(z)     (hypot  ((z).x, (z).y))
  22. #define cabsl(z)    (hypotl ((z).x, (z).y))
  23.  
  24. typedef enum
  25. {
  26.     DOMAIN = 1,    /* argument domain error -- log (-1)        */
  27.     SING,          /* argument singularity  -- pow (0,-2))     */
  28.     OVERFLOW,      /* overflow range error  -- exp (1000)      */
  29.     UNDERFLOW,     /* underflow range error -- exp (-1000)     */
  30.     TLOSS,         /* total loss of significance -- sin(10e70) */
  31.     PLOSS,         /* partial loss of signif. -- not used      */
  32.     STACKFAULT     /* floating point unit stack overflow       */
  33. }   _mexcep;
  34.  
  35. /* Constants rounded for 21 decimals. */
  36. #define M_E         2.71828182845904523536
  37. #define M_LOG2E     1.44269504088896340736
  38. #define M_LOG10E    0.434294481903251827651
  39. #define M_LN2       0.693147180559945309417
  40. #define M_LN10      2.30258509299404568402
  41. #define M_PI        3.14159265358979323846
  42. #define M_PI_2      1.57079632679489661923
  43. #define M_PI_4      0.785398163397448309616
  44. #define M_1_PI      0.318309886183790671538
  45. #define M_2_PI      0.636619772367581343076
  46. #define M_1_SQRTPI  0.564189583547756286948
  47. #define M_2_SQRTPI  1.12837916709551257390
  48. #define M_SQRT2     1.41421356237309504880
  49. #define M_SQRT_2    0.707106781186547524401
  50.  
  51. #define EDOM    33      /* Math argument */
  52. #define ERANGE  34      /* Result too large */
  53.  
  54. struct  exception
  55. {
  56.     int type;
  57.     char *name;
  58.     double  arg1, arg2, retval;
  59. };
  60.  
  61. struct  _exceptionl
  62. {
  63.     int type;
  64.     char *name;
  65.     double  arg1, arg2, retval;
  66. };
  67.  
  68. #define HUGE_VAL    _huge_dble
  69. extern double _huge_dble;
  70. #define _LHUGE_VAL   _huge_ldble
  71. extern double _huge_ldble;
  72.  
  73. double      acos    (double __x);
  74. double      asin    (double __x);
  75. double               atan    (double __x);
  76. double      atan2   (double __y, double __x);
  77. double      ceil    (double __x);
  78. double      cos     (double __x);
  79. double      cosh    (double __x);
  80. double      exp     (double __x);
  81. double               fabs    (double __x);
  82. double               __fabs__(double __x); /* Intrinsic */
  83. double      floor   (double __x);
  84. double      fmod    (double __x, double __y);
  85. double      frexp   (double __x, int *__exponent);
  86. double      ldexp   (double __x, int __exponent);
  87. double      log     (double __x);
  88. double      log10   (double __x);
  89. double      modf    (double __x, double *__ipart);
  90. double      pow     (double __x, double __y);
  91. double      sin     (double __x);
  92. double      sinh    (double __x);
  93. double      sqrt    (double __x);
  94. double      tan     (double __x);
  95. double      tanh    (double __x);
  96.  
  97. double acosl  (double __x);
  98. double asinl  (double __x);
  99. double atan2l (double __x, double __y);
  100. double          atanl  (double __x);
  101. double ceill  (double __x);
  102. double coshl  (double __x);
  103. double cosl   (double __x);
  104. double expl   (double __x);
  105. double          fabsl  (double __x);
  106. double floorl (double __x);
  107. double fmodl  (double __x, double __y);
  108. double frexpl (double __x, int *__exponent);
  109. double ldexpl (double __x, int __exponent);
  110. double log10l (double __x);
  111. double logl   (double __x);
  112. double modfl  (double __x, double *__ipart);
  113. double powl   (double __x, double __y);
  114. double sinhl  (double __x);
  115. double sinl   (double __x);
  116. double sqrtl  (double __x);
  117. double tanhl  (double __x);
  118. double tanl   (double __x);
  119.  
  120.  
  121. double      hypot (double __x, double __y);
  122. int         _matherr (struct exception *__e);
  123. double      poly  (double __x, int __degree, double *__coeffs);
  124. double      pow10 (int __p);
  125. double hypotl (double __x, double __y);
  126. double polyl  (double __x, int __degree, double *__coeffs);
  127. double pow10l (int __p);
  128.  
  129. #if !defined(__ABS_DEFINED)
  130. #define __ABS_DEFINED
  131. int         __abs__(int);
  132. int         abs(int __x);
  133. #  define abs(x)   __abs__(x)
  134.  
  135. #endif /* __ABS_DEFINED */
  136.  
  137. double               atof  (const char *__s);
  138. long                 labs  (long __x);
  139. int         _matherrl (struct _exceptionl *__e);
  140.  
  141. double          _atold (const char *__s);
  142.  
  143. #endif  /* __MATH_H */